package org.goobs.logic;

import java.util.HashSet;
import java.util.Set;

public class Term {
	private static int NEXT_NUM = 0;
	
	private String name;
	private int uniqueNum;
	
	private Set <Predicate> predicates = new HashSet <Predicate> ();
	
	
	public Term(String name){
		this.name = name;
		this.uniqueNum = NEXT_NUM++;
	}
	
	protected void addPredicate(Predicate p){
		predicates.add(p);
	}
	
	protected Set <Predicate> getPredicates(){
		return predicates;
	}
	
	
	public String toString(){
		return name;
	}
	
	public boolean equals(Object o){
		if(o instanceof Term){
			return ((Term) o).uniqueNum == this.uniqueNum;
		}else{
			return false;
		}
	}
	
	public int hashCode(){
		return uniqueNum;
	}
}
